<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateUsersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('users', function (Blueprint $table) {
            $table->increments('id');
	        $table->string('account',30)->default('')->comment('账号');
	        $table->string('phone',11)->default('')->comment('手机');
	        $table->string('nickname',30)->default('')->comment('昵称');
	        $table->string('salt',6)->default('123qwe')->comment('加密盐值');
            $table->string('password',32)->default('')->comment('密码');
	        $table->string('email',30)->default('')->comment('邮箱');
	        $table->string('avatar',300)->default('')->comment('头像');
	        $table->float('score',10,2)->default(0)->comment('积分');
	        $table->tinyInteger('status')->default(1)->commnet('状态,-1删除,0禁用,1正常');
	        $table->tinyInteger('sex')->default(0)->comment('性别,0保密,1男,2女');
            $table->timestamps();
            $table->index('account');
        });
	    \Illuminate\Support\Facades\DB::statement("ALTER TABLE `users` comment '用户表'");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('users');
    }
}
